package top.xiaoshuaila.moments.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import top.xiaoshuaila.moments.pojo.Dynamic;
import top.xiaoshuaila.moments.pojo.RespBean;
import top.xiaoshuaila.moments.service.IndexService;
import top.xiaoshuaila.moments.utils.Usersutils;

import java.util.List;

@Controller
@RequestMapping("/dynamic")
@Api(tags = "个人主页接口")
public class IndexController {
    @Autowired
    private IndexService indexService;
    @GetMapping("/getdynamic")
    @ResponseBody
    @ApiOperation("获取自己所有动态")
    public RespBean getdynamic(long id,int page){
        return RespBean.success("",indexService.getDynamicById(id,page));
    }

    @GetMapping("/gettotal")
    @ResponseBody
    @ApiOperation("获取自己动态总数")
    public RespBean gettotal() {
        return RespBean.success("success", indexService.gettotal(Usersutils.getuser().getId()));
    }
}
